"""
User Management Admin
"""
from django.contrib import admin
from .models import UserGroup


@admin.register(UserGroup)
class UserGroupAdmin(admin.ModelAdmin):
    list_display = ['name', 'category', 'user_count', 'created_at']
    list_filter = ['category', 'created_at']
    search_fields = ['name', 'description']
    filter_horizontal = ['users']
    
    def user_count(self, obj):
        return obj.user_count
    user_count.short_description = '用户数量'
